<?php

namespace app\shopapi\validate;

use think\Validate;

class Shop extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'category_id' => 'require',
        'shop_name' => 'require',
        'address'=> 'require',
        'commission_rate'=>'require',
        //'business_license_img'=>'require',
        //'business_license_num'=>'require',
        'body_name'=>'require',
        'banner_img'=>'require',
        'interior_img'=>'require',
        //'group_photo_img'=>'require',
        'realname'=>'require',
        'mobile'   => 'require|regex:1[3-9]\d{9}',
        'front_id_card_img'=>'require',
        'reverse_id_card_img'=>'require',
        'id_card_name'=>'require',
        'id_card_num'=>'require',
        //'id_card_start_time'=>'require',
        //'id_card_end_time'=>'require',
        'legal_person_phone'=>'require|regex:1[3-9]\d{9}',
        //'signature_img'=>'require',
        'bank_type'=>'require',
        //'bank_img'=>'require',
        'bank_num'=>'require',
        'bank_account_person'=>'require',
        'bank'=>'require',
        //'alipay_signing_account'=>'require',
        //'wechat_signing_account'=>'require',
    ];

    /**
     * 提示消息
     */
    protected $message = [
        'realname.require' => '请填写姓名',
        'mobile.require' => '请填写手机号',
        'mobile.regex' => '手机号格式不对',
        'category_id.require' => '请选择经营类目',
        'shop_name.require' => '请填写店铺名称',
        'address.require' => '请选择地址',
        'commission_rate.require' => '请填写佣金比例',
        //'business_license_img.require' => '请上传营业执照',
        //'business_license_num.require' => '请填写营业执照号',
        'body_name.require' => '请填写主体名称',
        'front_id_card_img.require' => '请上传身份证正面图片',
        'reverse_id_card_img.require' => '请上传身份证反面图片',
        'id_card_name.require' => '请填写证件姓名',
        'id_card_num.require' => '请填写证件号码',
        'legal_person_phone.require' => '请填写法人手机号',
        'legal_person_phone.regex' => '法人手机号格式不对',
        'signature_img.require' => '请上传法人签名',
        'bank_type.require' => '请选择账户类型',
        //'bank_img.require' => '请上传银行卡图片',
        'bank_num.require' => '请填写银行卡号',
        'bank_account_person.require' => '请填写开户人',
        'bank.require' => '请填写开户银行支行',
        'alipay_signing_account.require' => '请填写支付宝签约账号',
        'wechat_signing_account.require' => '请填写微信签约账号',
    ];


    /**
     * 验证场景
     */
    protected $scene = [
        'add'  => ['realname','category_id','shop_name','address','commission_rate','business_license_img','business_license_num','body_name',
            'front_id_card_img','reverse_id_card_img','id_card_name','id_card_num','legal_person_phone','signature_img','bank_type',
            'bank_img','bank_num','bank_account_person','bank','alipay_signing_account','wechat_signing_account'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'realname' => '姓名',
            'shop_name' => '店铺名称',
            'address' => '地址',
            'category_id' => '经营行业',
        ];
        $this->message = array_merge($this->message, [

        ]);
        parent::__construct($rules, $message, $field);
    }


}
